package com.yyf.product;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class PayProducer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    //发送支付消息
    public void sendPaySuccessMessage(String OrderId) {
        String message = "订单支付成功：" + OrderId;
        //路由建为"pay.success"
        rabbitTemplate.convertAndSend("pay.topic.exchange", "pay.success", message);
        System.out.println("生产者发送消息：" + message);
    }

}
